﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Routing;
using Newtonsoft.Json;
using Quizz.Infrastructure;
using Quizz.Library.Actions;
using Quizz.Library.Filter;
using Quizz.Library.Helper;
using Quizz.Library.QuizzServiceReference;

namespace Quizz.Library.Controller
{
    [RequireSsl]
    public class BaseController : System.Web.Mvc.Controller
    {
        protected override void Initialize(RequestContext requestContext)
        {
            base.Initialize(requestContext);
        }

        protected void CreateMenu(int activeId)
        {
            ViewData[Constants.MAIN_MENU] = MenuHelper.GenerateMainMenu(activeId);
        }

        public JsonNetResult JsonEx(object data)
        {
            return new JsonNetResult(data);
        }

        public JsonNetResult JsonEx(object data, JsonSerializerSettings settings)
        {
            return new JsonNetResult(data, settings);
        }

        public JsonNetResult JsonEx(object data, bool allowGet)
        {
            return new JsonNetResult(data, allowGet);
        }

        public JsonNetResult JsonEx(object data, bool allowGet, JsonSerializerSettings settings)
        {
            return new JsonNetResult(data, allowGet, settings);
        }
    }
}
